<?

//debug : ?MfcISAPICommand=but&year=2007&course_num=03682157
require_once "phpFunctions.php";
$htmlCourseData = getHtmlPage();
$htmlTestData = "";
$semesterFilter = "א'"; //$_GET['semester']; //"א'";
parseHtml($htmlCourseData,$htmlTestData);
$htmlArr = explode("<br>",$htmlCourseData);
$courseName = $htmlArr[1];
//print("course name = $courseName <br>");

$lecsArr = array(); // lectures array
$recsArr = array(); // recitations array
for($i = 2; $i<sizeof($htmlArr); ++$i)
{
	changeRowToArrays($htmlArr[$i],$lecsArr,$recsArr,$semesterFilter);
}
genereateSelectOptions($lecsArr,$recsArr,$courseName);
//adding course site

$siteLinks = getSiteLinks($htmlTestData);
for ($i = 0; $i<sizeof($siteLinks); ++$i)
{
	$serial = $_GET['serial'];
	$tempArr = $siteLinks[$i];
	if ("רתא" == $tempArr[1])
	{
		$lastChar = substr($tempArr[0],-1);
		if ("/" == $lastChar)
			$path = substr($tempArr[0],0,-1); //dropping the last /
		else
			$path = $tempArr[0];
		//echo "<input type=button id=site$serial value='+' onclick="."'addSite(\"$courseName\",\"$serial\",\"$path\")';"." />";
		echo "<input type=button id=site$serial value='+' onclick="."'addSite(\"$serial\",\"$path\")';"." />";
		
		break;
	}
		
}

?>

